<template>
  <div class="war">
    <div class="area-center">
      <!--美酒咖啡区域 -->
      <div class="top">
        <!-- 美酒咖啡区域 -->
        <Head title="美酒+咖啡"> </Head>
        <!-- 美酒咖啡文字区域 -->
        <div class="umit title-center">
          <!-- 标题区域 -->
          <div class="culture m-b-20">
            <div
              class="xiao "
              v-for="(item, index) in title"
              :key="index"
              @click="coffeetitle(item)"
            >
              <div class="left">
                <img src="../../../assets/black_star.png" alt="" />
              </div>
              <div class="zhong">
                {{ item.copywritingTitle }}
              </div>
            </div>
          </div>
          <div
            class="xiao  "
            v-for="(item, index) in list"
            :key="index"
            @click="coffee(item, index + 1)"
          >
            <div class="num">{{ index + 1 }}.</div>
            <div class="zhong">
              {{ item.coffeeType }}
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { coffeeType, findByCoffee } from "@/api/index";
import Head from "@/components/public/HeadPage.vue";
export default {
  data() {
    return {
      title: [],
      list: [],
    };
  },
  methods: {
    // 文化和感恩
    coffeetitle(item) {
      if (item.copywritingId == "b9ee19a6-d233-48e9-b988-47bf76460704") {
        //文化背景
        this.$router.push({
          path: "/coffeefive",
          query: {
            id: item.copywritingId,
            title: item.copywritingTitle,
          },
        });
      } else if (item.copywritingId == "fbf34d30-f7eb-47ab-bc74-e34524231411") {
        //文化视频
        this.$router.push({
          path: "/coffeevideo",
          query: {
            id: item.copywritingId,
            title: item.copywritingTitle,
          },
        });
      } else {
        this.$router.push({
          path: "/coffeesix",
          query: {
            id: item.copywritingId,
            title: item.copywritingTitle,
          },
        });
      }
    },

    coffee(item, i) {
      this.$router.push({
        path: "/coffeefour",
        query: {
          title: item.coffeeType,
          itemIndex: i,
          id: item.coffeeId,
          imgurl: item.coffeeIntro,
        },
      });
      sessionStorage.setItem("W-C-title", item.coffeeType);
      sessionStorage.setItem("i", i);
    },
  },
  components: {
    Head,
  },
  mounted() {
    //美酒+咖啡的标题
    coffeeType().then((res) => {
      if (res.data.code == 200) {
        // console.log(res.data.data);
        this.list = res.data.data;
      }
    }),
      //产品文化和视频标题
      findByCoffee().then((res) => {
        if (res.data.code == 200) {
          this.title = res.data.data;
        }
      });
  },
};
</script>

<style scoped>
.boa {
  width: 100%;

  display: flex;
  justify-content: center;
  margin-top: 0.05rem;
}
/* 版心区域 */
.center {
  width: 98%;
}
/* 访谈和电视总区域 */

/* 头标区域 */
.top h3 img {
  width: 0.24rem;
  margin-right: 0.05rem;
}
/* 文字区域 */
.umit {
  width: 100%;
  min-height: 0.4rem;
  border-radius: 0.1rem;
  margin-top: 0.05rem;
  background-color: white;
}
.m-t {
  margin: 0.04rem 0;
}
.umit h4 {
  font-size: 0.18rem;
  display: flex;
  justify-content: center;
}
.umit .tu {
  width: 0.2rem;
  height: 0.24rem;

  margin-right: 0.05rem;
}
.umit .tu img {
  width: 0.2rem;
  height: 0.27rem;
}
/* 文化和感恩区域 */
.culture {
  width: 100%;

}
.xiao {
  width: 100%;
  display: flex;
}
/* 左边区域 */
.xiao .left {
  width: 5%;
  height: 100%;
  margin-left: 0.1rem;
}
.xiao .left img {
  width: 0.2rem;
  height: 0.2rem;
  margin-top: 0.03rem;
}
.xiao .num {
  width: 5%;
  height: 0.3rem;
  margin-left: 0.1rem;
  text-align: center;
  line-height: 0.3rem;
}

/* 中间区域 */
.zhong {
  width: 95%;
  height: 100%;
  line-height: 0.3rem;
  padding-left: 0.05rem;
}
/* 底部区域 */
.bottom {
  width: 100%;
  height: 100%;
  margin-top: 0.1rem;
}

.bottom h3 {
  width: 100%;
  height: 0.35rem;
  text-align: center;
}
/* 内容区域 */
.context {
  width: 100%;
  height: 1rem;
  font-weight: 700;
}
</style>